﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace BooksOnline.Serivces
{
    public class UnitOfWork
    {
        private UnitOfWork()
        {
            
        }
        private static UnitOfWork currentInstance;

        public static UnitOfWork CurrentInstance
        {
            get
            {
                if (currentInstance == null)
                    currentInstance = new UnitOfWork();

                return currentInstance;
            }
        }
        
        public void Commit()
        {
            if(currentInstance != null)
            {
                ModelFactory.GetBooksModel().SaveChanges();
            }
            else
            {
                // Log Error
            }
        }


    }
}